package Iterators;

import java.util.Vector;

public class BookShelf implements Aggreate {
    private Vector<Book> books;
    private int last = 0;

    public BookShelf(int maxsize) {
        this.books = new Vector<Book>(maxsize);
    }

    public Book getBookas(int index) {
        return books.get(index);
    }

    public void append(Book book) {
        books.add(last,book);
        last++;
    }

    public int getLength() {
        return last;
    }

    public Iterator iterator() {
        return new BookShelfIterator(this);
    }
}
